#include <sys/time.h>
#include <stdio.h>
class Caltime
{
public:
    void set_start_time(){gettimeofday(&start_,NULL);}
    void set_stop_time(){gettimeofday(&stop_,NULL);}
    double cal_time_ms()
    {
        start_time = start_.tv_sec*1000.+start_.tv_usec/1000.;
        stop_time = stop_.tv_sec*1000.+stop_.tv_usec/1000.;
        return stop_time - start_time;
    }
private:
    struct timeval start_,stop_;
    double start_time,stop_time;
};